package com.yuanfeng.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanfeng.base.dto.DealerApplyInfoDTO;
import com.yuanfeng.base.entity.BaseDealerApplyInfoEntity;
import com.yuanfeng.base.vo.DealerLevelInfoVO;
import com.yuanfeng.base.vo.DealerShopInfoVO;
import com.yuanfeng.base.vo.ManageGoodsSelfCatVO;
import com.yuanfeng.base.vo.SupplyShopSelfCatVO;
import com.yuanfeng.commoms.dto.base.DealerGoodsUserInfoDTO;
import com.yuanfeng.commoms.vo.base.DealerApplyInfoVO;
import com.yuanfeng.commoms.vo.goods.DealerPutawayRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @ClassName BaseDealerApplyInfoMapper
 * @Description 分销商申请信息表
 * @Author cyp
 * @Date 2023-05-24 09:51:09
 * @Version 1.0
 **/
@Mapper
public interface BaseDealerApplyInfoMapper extends BaseMapper<BaseDealerApplyInfoEntity> {

    /**
     * 查询登录用户已申请经销商成功的店铺id
     *
     * @param dealerShopId
     * @param supplierShopList
     * @return
     */
    List<DealerApplyInfoVO> queryDealerApplyListByShop(@Param("dealerShopId") String dealerShopId, @Param("supplierShopList") List<Integer> supplierShopList);

    /**
     * 查询店铺是否需要经销审核
     * @param goodsUserInfo
     * @return
     */
    DealerApplyInfoVO queryDealerApplyByShop(DealerGoodsUserInfoDTO goodsUserInfo);

    /**
     * 查询店铺名称
     * @param shopId
     * @return
     */
    String queryShopName(Integer shopId);

    /**
     * 插入经销申请数据
     * @param dealerApplyInfo
     */
    void insertSelective(DealerApplyInfoVO dealerApplyInfo);

    /**
     * 修改经销申请数据
     * @param dealerApplyInfo
     */
    void updateByPrimaryKeySelective(DealerApplyInfoVO dealerApplyInfo);


    IPage<DealerShopInfoVO> selectDealerShop(IPage<DealerShopInfoVO> page , @Param("param") Map<String, Object> map);

    /**
     * 更新经销商信息
     *
     * @param map
     * @return
     */
    Integer updateDealerApplyInfotByDealerMap(@Param("param") Map<String, Object> map);

    /**
     * 更新供应商信息
     *
     * @param map
     * @return
     */
    Integer updateDealerApplyInfotBySupplierMap(@Param("param") Map<String, Object> map);

    /**
     * 查询分类
     * @param shopId
     * @param commonId
     * @return
     */
    List<Integer> queryAllCatId(@Param("shopId") Integer shopId,@Param("commonId") Integer commonId);

    List<SupplyShopSelfCatVO> queryAllShopCatList(@Param("shopId") Integer shopId,@Param("parentId") Integer parentId);

    /**
     * 查询已通过分类
     * @param shopId
     * @param dealerStatus
     * @param applyId
     * @return
     */
    List<ManageGoodsSelfCatVO> queryShopDealerCat(@Param("shopId") Integer shopId,@Param("dealerStatus") Integer dealerStatus,@Param("applyId") Integer applyId);

    /**
     * 查询店铺所有主分类
     * @param shopId
     * @param applyId
     * @param parentId
     * @return
     */
    List<SupplyShopSelfCatVO> queryAllShopCat(@Param("shopId") Integer shopId,@Param("applyId") Integer applyId,@Param("parentId") Integer parentId);

    IPage<DealerApplyInfoVO> queryDealerApplyInfo(Page<DealerApplyInfoVO> page,@Param("param") DealerApplyInfoDTO dealerApplyInfo);

    DealerLevelInfoVO selectByLevelInfo(@Param("dealerLevelId")Integer dealerLevelId);

    int deleteByApplyInfo(@Param("id")Integer id);

    DealerApplyInfoVO selectByApplyInfo(@Param("id")Integer id);

    int updateApplyCatStatus(@Param("dealerStatus") Integer dealerStatus,@Param("applyId") Integer applyId);

    List<DealerPutawayRecordVO> queryPutawayRecordInfo(@Param("param") DealerPutawayRecordVO record);

    int deleteRecordStateBatch(@Param("param") DealerPutawayRecordVO record);

    int cancelDealerGoods(@Param("commonIdList") List<Integer> commonIdList);

    int cancelDealerGoodsBase(@Param("commonIdList") List<Integer> commonIdList);
}

